package com.turing.post.salesmanage.util;

import java.math.BigInteger;
import java.util.Date;
import java.util.List;

import javax.ejb.Local;
import javax.ejb.Remote;

import com.turing.post.util.PCPSApplicationException;
import com.turing.post.util.PCPSWebInput;

/**
 * 赎回单DAO接口
 * 
 * @author zxp
 * @Jan 17, 2013
 */
@Remote
@Local
public interface RedempOrderDao {
	/**
	 * 根据赎回单ID查询
	 * 
	 * @param redempOrderId
	 *            充值单编号
	 * @return 赎回单
	 */
	public RedempOrder getRedempOrderByRedempOrderId(BigInteger redempOrderId);

	/**
	 * 查询锁定赎回单
	 * 
	 * @param redempOrderId
	 * @return
	 */
	public RedempOrder getRedempOrderForUpdate(BigInteger redempOrderId);

	/**
	 * 查询赎回单分页列表
	 * 
	 * @param webInput
	 * @param saleBranchNo
	 * @param startTime
	 * @param endTime
	 * @param orderStatus
	 * @param btnStatus
	 * @param page
	 * @return
	 */
	public List<RedempOrder> getRedempOrderListByCondition(
			PCPSWebInput webInput, String redempOrderId,
			String saleBranchNo, String startTime, String endTime,
			String orderStatus, String btnStatus, Integer page);

	/**
	 * 查询赎回单记录数
	 * 
	 * @param webInput
	 * @param saleBranchNo
	 * @param startTime
	 * @param endTime
	 * @param orderStatus
	 * @param btnStatus
	 * @return
	 */
	public BigInteger getRedempOrderTotalByCondition(PCPSWebInput webInput,
			String redempOrderId, String saleBranchNo, String startTime,
			String endTime, String orderStatus, String btnStatus);

	/**
	 * 创建赎回单
	 * 
	 * @param redempOrder
	 * @throws PCPSApplicationException
	 */
	public void insert(RedempOrder redempOrder) throws PCPSApplicationException;

	/**
	 * 修改赎回单
	 * 
	 * @param redempOrder
	 * @throws PCPSApplicationException
	 */
	public void update(RedempOrder redempOrder) throws PCPSApplicationException;

	/**
	 * 根据时间，发卡商编号，状态查询 return List<RedempOrder>
	 */
	public List<Object[]> getRedempOrderByAlarm(String issuecompanyno,
			Date starttranDate, Date endtranDate, Double rulemoney)
			throws PCPSApplicationException;

	/**
	 * 根据时间，发卡商编号，状态,赎回人id查询 return List<RedempOrder>
	 */
	public List<RedempOrder> getRedempOrder(String issuecompanyno,
			Date starttranDate, Date endtranDate, String onwerid)
			throws PCPSApplicationException;

	/**
	 * 统计指定机构的赎回业务
	 * 
	 * @param saleBranchNo
	 * @param tranDate
	 * @return
	 */
	public BigInteger[] getBranchDaySettByBranchAndTranDate(
			String saleBranchNo, Date tranDate);
	
	/**
	 * 查询赎回单分页列表Sum
	 * 
	 * @param webInput
	 * @param saleBranchNo
	 * @param startTime
	 * @param endTime
	 * @param orderStatus
	 * @param btnStatus
	 * @param page
	 * @return
	 */
	public Object[] getRedempOrderListByConditionSum(
			PCPSWebInput webInput, String redempOrderId,
			String saleBranchNo, String startTime, String endTime,
			String orderStatus, String btnStatus);
	
	/**
	 * 根据赎回单编号查询
	 * @param redempOrderSeqNo
	 * @return
	 */
	public RedempOrder getRedempOrderByredempOrderSeqNo(String redempOrderSeqNo);
}